package io.github.junxworks.qt.modules.data.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import io.github.junxworks.qt.modules.data.mapper.HistoryMapper;
import io.github.junxworks.qt.modules.data.service.HistoryService;
import io.github.junxworks.qt.modules.tushare.entity.DStockTradeDaily;

@Service("HistoryService")
public class HistoryServiceImpl implements HistoryService {

	@Autowired
	private HistoryMapper historyMapper;

	@Override
	public String getTransDate(int range) {
		return historyMapper.getTransDate(range - 1);
	}

	@Override
	public String getTransDateBefore(String date, int range) {
		return historyMapper.getTransDateBefore(date, range - 1);
	}

	@Override
	public DStockTradeDaily getTradeDataByCodeAndDate(String stockCode, String tradeDate) {
		return historyMapper.getTradeDataByCodeAndDate(stockCode, tradeDate);
	}

	@Override
	public List<DStockTradeDaily> getTradeDataByCodeAndDateRange(String stockCode, String startDate, String endDate) {
		return historyMapper.queryTradeDataByCodeAndDateRange(stockCode, startDate, endDate);
	}

}
